@extends('layouts.master3')
@section("title","千里码-文章")
@section("css")
    <link href="/css/base.css" rel="stylesheet">
    <link href="/css/discuss.css" rel="stylesheet">
@endsection
@section("content")
    <?php
    use App\Utils;
    ?>
    <div class="contain">

        <div class="qa-body-wrapper">
            <!--<div class="qa-header">-->
            <!--<div class="qa-header-clear">-->
            <!--</div>-->
            <!--<form class="qa-search-bar" method="get" action="" _lpchecked="1">-->
            <!--<div class="input-group">-->
            <!--<input type="text" name="q" value="" class="form-control" placeholder=" Search">-->
            <!--<span class="input-group-btn">-->
            <!--<button type="submit" class="btn btn-primary">-->
            <!--&nbsp;<span class="glyphicon glyphicon-search">-->
            <!--</span>&nbsp;</button>-->
            <!--</span>-->
            <!--</div>-->
            <!--</form>-->
            <!--<a href="./ask" class="btn btn-success btn-lg qa-ask-btn">提问</a>-->
            <!--</div>-->
            <!-- ql-header E-->
            <div class="qa-main-shadow">
                <div class="qa-main-wrapper">
                    <div class="qa-nav-main">
                        <ul class="qa-nav-main-list">
                            <li class="qa-nav-main-item qa-nav-main-new">
                                <a href="/article/all/new"
                                   class="qa-nav-main-link @if($types=="new") active @endif">最新</a>
                            </li>
                            <li class="qa-nav-main-item qa-nav-main-hot ">
                                <a href="/article/all/hot"
                                   class="qa-nav-main-link @if($types=="hot") active @endif">热门</a>
                            </li>
                        </ul>

                        <div class="qa-nav-main-clear">
                        </div>

                    </div>
                    <!--
                                    <a class="btn btn-success pull-right ask-a">发布链接</a>
                    -->
                    <a target="_blank" href="/genart" class="btn btn-success pull-right ask-a">分享文章</a>
                    <!-- nav-main E-->
                    <div class="qa-sidepanel">
                        <div class="qa-sidebar well">
                            <p>欢迎来到千里码文章版块</p>
                            <p>这里可以查阅、分享Qlcoder中任务相关的技术拓展文章，或者其他与开发相关的技术心得、开发技巧。</p>
                            <p>投一票的权重为自己当前的分数，权重会随着你的分数变化而变化。</p>
                            <p>请阅读<a target="_blank" href="/help"><b style="color:red;">帮助中心</b></a>以便更好的使用文章板块</p>
                        </div>
                    </div>

                    <!-- qa-sidebar E-->
                    <div class="qa-main">
                        <!--<h1>最新问题与解答</h1>-->
                        <div class="qa-part-q-list">
                            <div class="qa-q-list">
                                @foreach($articles as $art)
                                    <div class="qa-q-list-item" id="1">
                                        <div class="qa-q-item-stats">
                                            <div class="pull-left ">
                                                <div class="vote mr_t10">
                                                    <button class="up @if($art['fav']==0) press @endif"
                                                            data-token="{{csrf_token()}}" data-id="{{$art->id}}"
                                                            data-type="2" title="赞同"
                                                            @if (Auth::check() && $art->userid == Auth::user()->id)
                                                            disabled
                                                            @endif
                                                    >
                                                        @if (Auth::check() && $art->userid != Auth::user()->id)
                                                            <i class="vote_arrow"></i>
                                                        @endif
                                                            <span class="count"
                                                              data-count="{{$art->score}}">{{$art->score}}</span>
                                                    </button>
                                                    <!--  <button class="down" data-statu="false" title="反对，不显示名字">
                                                          <i class="vote_arrow"></i>
                                                      </button>-->
                                                </div>
                                            </div>
                                        </div>
                                        <div class="qa-q-item-main">
                                            <div class="qa-q-item-title">
                                                <a target="_blank" href="{{$art->content}}"><span
                                                            title="">{{$art->title}}</span></a>
                                            </div>
                                            <p class="mr0">{{$art->suggest}}</p>
                                    <span class="qa-q-item-avatar-meta">
                                        <span class="qa-q-item-meta">
                                            <!-- <span class="black">【原创】 </span> -->
                                            <span class="qa-q-item-when">{{$art->author->name}} 推荐,
                                                <span class='vote-count' id="vote-count-{{ $art->id }}">{{ $art->vote }}</span>
                                                人赞同
                                            </span>
                                            @if($art->tag!="其他")
                                                <a class="qa-q-item-class gray"
                                                   href="/article/{{$art->tag}}">{{$art->tag}}</a>
                                            @endif
                                        </span>
                                    </span>
                                        </div>
                                        <div class="qa-q-item-avatar pull-right"><a
                                                    href="/profile/{{Utils::id2url($art->author->id)}}" target="_blank"><img
                                                        src="{{$art->author->avatar->url('thumb')}}"></a></div>
                                        <div class="qa-q-item-clear"></div>
                                    </div> <!-- END qa-q-list-item -->
                                @endforeach
                            </div> <!-- END qa-q-list -->
                            <?php echo $articles->render();?>
                        </div>
                        <!--
                                            <div class="qa-suggest-next">
                                                <a href="">加载更多</a>
                                            </div>
                        -->
                    </div>
                </div>
            </div>
        </div>

    </div>
@endsection
@section('js')
    <script src="/js/vote.js"></script>
@endsection
